<!--
    新闻列表

    author Yuanao
    date 2021年11月11日21:40:46
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="">
  <meta name="author" content="">

  <title>在线预约</title>

  <!-- css -->
  <link href="/css/bootstrap.min.css" rel="stylesheet" type="text/css">
  <link href="/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
  <link rel="stylesheet" type="text/css" href="/plugins/cubeportfolio/css/cubeportfolio.min.css">
  <link href="/css/nivo-lightbox.css" rel="stylesheet"/>
  <link href="/css/nivo-lightbox-theme/default/default.css" rel="stylesheet" type="text/css"/>
  <link href="/css/owl.carousel.css" rel="stylesheet" media="screen"/>
  <link href="/css/owl.theme.css" rel="stylesheet" media="screen"/>
  <link href="/css/animate.css" rel="stylesheet"/>
  <link href="/css/style.css" rel="stylesheet">

  <!-- boxed bg -->
  <link id="bodybg" href="/bodybg/bg1.css" rel="stylesheet" type="text/css"/>
  <!-- template skin -->
  <link id="t-colors" href="/color/default.css" rel="stylesheet">
  <!--    -->
  <script src="/js/pageWriteHtml.js" charset="UTF-8"></script>
  <style>
    .item {
      width: 80%;
      margin: 10px auto;
      padding: 10px;
      background-color: white;
      border-radius: 10px;
    }
    .item img {
      width: 100px;
      height: 100px;
    }
  </style>
</head>

<body id="page-top" data-spy="scroll" data-target=".navbar-custom">

<div id="wrapper">

  <!--  将头部信息写入到这里  -->
  <script>writeHtmlAsHead("新闻");</script>

  <div id="news_row" style="margin-top:200px; ">
<!-- 下面是模板留底
    <div class="item">
      <div>1</div>
      <div>你好世界</div>
      <div><img src="" /></div>
      <div>2021年11月11日21:49:48</div>
    </div>-->

  </div>

  <!--  将头部信息写入到这里  -->
  <script>writeHtmlAsFooter();</script>


</div>
<a href="#" class="scrollup"><i class="fa fa-angle-up active"></i></a>

<!-- Core JavaScript Files -->
<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/jquery.easing.min.js"></script>
<script src="/js/wow.min.js"></script>
<script src="/js/jquery.scrollTo.js"></script>
<script src="/js/jquery.appear.js"></script>
<script src="/js/stellar.js"></script>
<script src="/plugins/cubeportfolio/js/jquery.cubeportfolio.min.js"></script>
<script src="/js/owl.carousel.min.js"></script>
<script src="/js/nivo-lightbox.min.js"></script>
<script src="/js/custom.js"></script>
<script src="/contactform/contactform.js"></script>

<script>

  //获取新闻信息
  $.post("http://localhost:8080/api/news/listNewsByTime",{
    page:1,
    limit: 20
  },(data)=> {
    if (data.code === 0) {
      let $newsRow = $("#news_row");
      for (let i = 0; i < data.count; i++) {
        let obj = data.data[i];
        let elem = $('<div class="item" onclick="skip('+ obj.id +')">' +
                '      <h6>'+obj.title+'</h6>' +
                '      <div><img src="'+obj.img+'"/></div>' +
                '      <div>'+obj.time+'</div>' +
                '    </div>');
        $newsRow.append(elem);
      }
    }
  });

  /**
   * 控制页面跳转
   * @param id
   */
  function skip(id) {
    document.location = "newsShow.html?id="+id;
  }


</script>

</body>

</html>
